﻿using Autofac;
using System.IdentityModel.Tokens.Jwt;
using System.Reflection;

namespace DFGK_WMS.WebAPI
{
    public class AutoFacManage:Autofac.Module
    {
        protected override void Load(ContainerBuilder builder)
        {
            var iapiservice = Assembly.Load("DFGK_WMS.Repository");

            builder.RegisterAssemblyTypes(iapiservice).Where(t => t.Name.EndsWith("Repository") || t.Name.EndsWith("Service")).AsImplementedInterfaces();
           // builder.RegisterAssemblyTypes(iapiservice).AsImplementedInterfaces();


            builder.RegisterType<JwtSecurityTokenHandler>().SingleInstance();
            builder.RegisterType<TokenHelper>().SingleInstance();
        }
    }
}
